/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ee.ut.math.esi.service;

import java.io.IOException;
import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.xml.parsers.ParserConfigurationException;
import org.json.JSONException;
import org.xml.sax.SAXException;

/**
 *
 * @author ool
 */
@WebService(serviceName = "SearchBrowseServiceService", portName = "SearchBrowseServicePort", endpointInterface = "movierestsoapservice.SearchBrowseServicePortType", targetNamespace = "http://MovieRestSoapService/", wsdlLocation = "META-INF/wsdl/MovieRestSoapService/localhost_8080/SoapService/wsdl.wsdl")
@Stateless
public class MovieRestSoapService {
    
    private RottenTomatoesResource resource;

    public MovieRestSoapService() {
        resource = new RottenTomatoesResource();
    }

    public movierestsoapservice.SearchServiceResponse searchService(movierestsoapservice.SearchServiceRequest input) throws JSONException, SAXException, IOException, ParserConfigurationException {
        return resource.search(input.getTitle(), input.getPage());
    }

    public movierestsoapservice.BrowseServiceResponse browseService(movierestsoapservice.BrowseServiceRequest input) throws JSONException, SAXException, IOException, ParserConfigurationException {
        return resource.browse(input.getCountryCode(), input.getLimit());
    }
    
}
